import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import Components from "unplugin-vue-components/vite";
import styleImport, { VantResolve } from "vite-plugin-style-import";
import { VantResolver } from "unplugin-vue-components/resolvers";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [VantResolver()],
    }),
    // styleImport({
    //   resolves: [VantResolve()],
    // }),
  ],
  server: {
    host: "0.0.0.0",
    port: 8111,
    // 是否开启 https
    https: false,
    proxy: {
      "/api/": {
        target: "http://192.168.0.135:10010/ossGatewayService",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    },
  },
  resolve: {
    alias: {
      "@": "/src/",
    },
  },
});
